package util

object StopWatch {
  def apply[R](fn: => R)(timeFn: Long => Unit): R = {
    val (r, t) = withMillTake(fn)
    timeFn(t)
    r
  }
  def withMillTake[R](fn: => R) = {
    val time = System.currentTimeMillis
    fn -> (System.currentTimeMillis - time)
  }
}